package tech.aiotcloud.city.citybigdataweb.main;

import android.app.Application;
import android.content.Context;
import android.os.Handler;


public class MainApplication extends Application {


    @Override
    public void onCreate() {
        super.onCreate();
        init(this)
                .configure();
    }


    public static Configurator init(Context context) {
        Configurator.getInstance()
                .withApplicationContrext(context.getApplicationContext());
        return Configurator.getInstance();
    }


    public static Configurator getConfigurator() {
        return Configurator.getInstance();
    }


    public static <T> T getConfiguration(Object key) {
        return getConfigurator().getConfiguration(key);
    }

    public static Context getApplication() {
        return getConfiguration(ConfigKeys.APPLICATION_CONTEXT);
    }

    public static Handler getHandler() {
        return getConfiguration(ConfigKeys.HANDLER);
    }
}
